Skip to content

test: avoid initial-break sync in attach-only debugger tests#61937

Draft
inoway46 wants to merge 1 commit intonodejs:mainfrom
inoway46:debugger-flaky-61762-attach-sync
Draft

test: avoid initial-break sync in attach-only debugger tests#61937
inoway46 wants to merge 1 commit intonodejs:mainfrom
inoway46:debugger-flaky-61762-attach-sync

Conversation

@inoway46
Copy link
Contributor

@inoway46 inoway46 commented Feb 22, 2026

Summary

  • replace waitForInitialBreak() with attach/prompt synchronization in:
    • test/parallel/test-debugger-watch-validation.js
    • test/parallel/test-debugger-extract-function-name.mjs
    • test/parallel/test-debugger-random-port-with-inspect-port.js
  • for tests that do not assert initial break ... in output, sync on Debugger attached. (+ waitForPrompt() where needed)
  • keep test/common/debugger.js behavior unchanged (test-side synchronization only)

Context

test-macOS unusual-path failures have shown intermittent timeouts in waitForInitialBreak() for attach-only debugger tests.
In failing logs, attach and prompt can appear, but the initial break banner wait becomes a fragile sync point.

Hypothesis

The flake is likely a timing race in startup output ordering:

  • waitForInitialBreak() depends on observing the initial break ... in banner
  • under some timing conditions, attach/prompt ordering differs and the break-banner wait becomes brittle for tests that do not actually assert break-banner content

This change narrows synchronization only in the three target tests and does not claim a single root cause in debugger internals.

Why this approach

  • keep test intent intact
  • reduce dependence on a brittle initial-break wait for attach-only assertions
  • minimize blast radius by changing only affected tests

Testing

UNUSUAL="$HOME/dir with \$unusual\"chars?'åß∂ƒ©∆¬…\`"
mkdir -p "$UNUSUAL"
ln -sfn "$PWD" "$UNUSUAL/node"
cd "$UNUSUAL/node"
  • ./tools/test.py -p actions parallel/test-debugger-watch-validation (passes locally)
  • ./tools/test.py -p actions parallel/test-debugger-random-port-with-inspect-port (passes locally)
  • ./tools/test.py -p actions parallel/test-debugger-extract-function-name (passes locally)
  • Additional unusual-path stress runs were executed on this PR branch:
    • ./tools/test.py -p actions -j1 --repeat 50 parallel/test-debugger-watch-validation parallel/test-debugger-random-port-with-inspect-port parallel/test-debugger-extract-function-name
    • ./tools/test.py -p actions -j4 --repeat 100 parallel/test-debugger-watch-validation parallel/test-debugger-random-port-with-inspect-port parallel/test-debugger-extract-function-name
  • CI passes on macOS

Refs: #61762

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Feb 22, 2026
@inoway46 inoway46 changed the title test: relax debugger attach sync in tests test: avoid initial-break sync in attach-only debugger tests Feb 22, 2026
@inoway46 inoway46 force-pushed the debugger-flaky-61762-attach-sync branch from 497d1a4 to 67c068f Compare February 28, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants